
local duzun= fk.CreateSkill{
    name = "steam__duzun",
  }
Fk:loadTranslationTable{
    ["steam__duzun"]="独尊天下",
    [":steam__duzun"]="当你手牌数或体力值变化后，若为唯一，你可以将另一项调整至相同。",
    ["#steam__duzun"]="独尊",

}

duzun:addEffect(fk.AfterCardsMove, {
    can_trigger = function(self, event, target, player, data)
        if player:hasSkill(self.name) and not table.find(player.room:getOtherPlayers(player),function (p)
            return p:getHandcardNum()==player:getHandcardNum()
        end) then 
            for _, move in ipairs(data) do
                if move.to == player and move.toArea == Card.PlayerHand then
                  return true
                elseif move.from == player then
                  for _, info in ipairs(move.moveInfo) do
                    if info.fromArea == Card.PlayerHand then
                      return true
                    end
                  end
                end
              end
            end
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local n=player:getHandcardNum()
        room:setPlayerProperty(player,"hp",n)
    end
})


duzun:addEffect(fk.HpChanged, {
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(self.name) and data.who==player and not table.find(player.room:getOtherPlayers(player),function (p)
            return p.hp==player.hp
        end)
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local n=player.hp
        n = player:getHandcardNum() - n
        if n > 0 then
          room:askToDiscard(player, {
            min_num = n,
            max_num = n,
            include_equip = false,
            skill_name = self.name,
            cancelable = false,
          })
        elseif n < 0 then
          player:drawCards(-n, self.name)
        end
    end
})









return duzun